package initalize

import (
	"github.com/gin-gonic/gin"
	"net/http"
	"sub_web/src/middlewares"
	"sub_web/src/router"
)

func InitRouter() *gin.Engine {
	baseRouter := gin.Default()
	baseRouter.GET("/health", func(c *gin.Context) {
		c.JSON(http.StatusOK, gin.H{
			"code":    http.StatusOK,
			"success": true,
		})
	})
	baseRouter.Use(middlewares.Cors())
	myRouter := baseRouter.Group("/v1")
	router.BindSubRouter(myRouter)
	return baseRouter
}
